# 4.2统计字符个数
str = input("请输入一个字符串：")
math, word, spase, other = 0, 0, 0, 0
for i in str:
    if i.isalpha():
        word = word + 1
    elif i.isdigit():
        math = math + 1
    elif i == ' ':
        spase = spase + 1
    else:
        other = other + 1
print("math={}\nword={}\nsapse={}\nother={}".format(math, word, spase, other))
